package qa

import (
	. "go-share/models"

	"go-share/lib/qa/drivers"
)

const (
	QA_DRIVER_TULING = "tuling"
)

type IQa interface {
	SendText(string, string, int64, int64) (*ReceiveJsonWithQA, error)
}

type IQaFactory struct {
	qa IQa
}

func NewQaFactory(kind string) *IQaFactory {
	return &IQaFactory{qa: getInstance(kind)}
}

func (this *IQaFactory) SendText(content string, loc string, refId int64, userId int64) (*ReceiveJsonWithQA, error) {
	return this.qa.SendText(content, loc, refId, userId)
}

func getInstance(kind string) IQa {
	switch kind {
	case QA_DRIVER_TULING:
		return drivers.NewQaTuling()
		break
	default:
		return nil
	}

	return nil
}
